/**
 * Created by webrx on 2017-09-28.
 */
$(function () {
    var phone = false;
    var pwd = false;

    //手机号验证
    $("#email_").blur(function(){
        var val = $("#email_");//手机
        var tip = $("#login_email_tip");//提示标签
        var regexp_mobile=/^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0-9]|17[0-9])\d{8}$/;
        if (regexp_mobile.test(val.val())){
            tip.html("用户名正确!");
            tip.css("color","green");
            phone = true;
        }else {
            tip.html("用户名错误!");
            tip.css("color","red");
        }

    });

    //密码验证
    $("#password_").blur(function(){
        var val = $("#password_");//密码
        var tip = $("#login_password_tip");//提示标签
        var regexp_password=/^[\@A-Za-z0-9\!\#\$\%\^\&\*\.\~\`\[\]\{\}\;\:\'\"\,\<\.\>\/\?\-\_\=\+\(\)\|\\]{6,25}$/;
        if (regexp_password.test(val.val())){
            pwd = true;
            tip.html("");
        }else {
            tip.html("密码应在6~25字符之间!");
            tip.css("color","red");
        }

    });


    //提交
    $("#login-you").click(function () {
        if (pwd && phone){
        } else {
            $("#loginform").attr("action","#");
        }
    })

})